package ExerciseThree;

public class Account {

	//属性
	private int id;// 账号
	private double balance;//余额
	private double annualInterestRate;//年利率
	
	//构造器
	public Account ()
	{
		
	}
	
	public Account(int id, double balance, double annualInterestRate)
	{
		this.id = id;
		this.balance = balance;
		this.annualInterestRate = annualInterestRate;
	}
	
	//方法
	public void setId(int id)
	{
		this.id = id;
	}
	
	public int getId()
	{
		return id;
	}
	
	public void setBalance(double balance)
	{
		this.balance = balance;
	}
	
	public double getBalance()
	{
		return balance;
	}
	
	public void setAnnualinterestrate(double annualInterestrate)
	{
		this.annualInterestRate = annualInterestRate;
	}
	
	public double getAnnualinterestrate()
	{
		return annualInterestRate;
	}
	
	public void withdraw(double amount)//取钱
	{
		if(amount>balance)
		{
			System.out.println("余额不足");
		}
		else
		{
			balance-=amount;
			System.out.println("成功取出："+amount);
		}
	}

	public void deposit(double amount)
	{
		balance+=amount;
		System.out.println("成功存入："+amount);
	}
	
}
